//
//  CityViewController.m
//  UIHomeWork09-省市区三级页面
//
//  Created by tusm on 16/7/26.
//  Copyright © 2016年 tusm. All rights reserved.
//

#import "CityViewController.h"
#import "ZoneViewController.h"

@interface CityViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,retain)NSMutableArray *arrOfCity;
@end

@implementation CityViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //存放city类
    self.arrOfCity = [NSMutableArray arrayWithArray:_proMedian.array];
    self.navigationItem.title = self.proMedian.name;
    [self createSubView];
}
- (void)createSubView{
    _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    [self.view addSubview:_tableView];
    _tableView.delegate = self;
    _tableView.dataSource = self;

    [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"pool1"];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return self.arrOfCity.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"pool1"];
    cell.textLabel.text = [_arrOfCity[indexPath.row] name];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    ZoneViewController *vc = [[ZoneViewController alloc] init];
    vc.cityMedian = _arrOfCity[indexPath.row];
    [self.navigationController pushViewController:vc animated:YES];


}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
